package com.runa.monitor.platinterface.service;

import com.alibaba.fastjson.JSON;
import com.runa.monitor.platinterface.mqtt.MqttUtil;
import com.runa.persistence.SerializeUtil;
import com.runa.persistence.entity.gw.GwDown;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 2025/1/15 13:49
 * zhangYB
 */
@Slf4j
@Service
public class GwService {

    public void downTiming(String id) {
        try {
            GwDown gwDown = GwDown.getDownTiming(id);
            String topic = "/aigw/" + id + "/down";
            MqttUtil.send(topic, JSON.toJSONString(gwDown).getBytes());
            log.debug("网关校时: {} {}", topic, JSON.toJSONString(gwDown));
        } catch (Exception e) {
            log.error("downTiming: {}", e);
        }
    }



}
